<script type="text/javascript" language="javascript">

function actionPassword(object){

	var url = object.attr("cid");

	alert(url);

	var json = {
		'User[user_password]':$("#User_user_password").val()
	};

	if($("#User_user_password").val() == ''){
		$.msgbox({
			height:100,
			width:250,
			content:{type:'alert',content:'用户密码不能为空！'},
			animation:4
		});
	}else if($("#User_user_repassword").val() == ''){
		$.msgbox({
			height:100,
			width:250,
			content:{type:'alert',content:'重复密码不能为空！'},
			animation:4
		});
	}else if($("#User_user_password").val() != $("#User_user_repassword").val()){
		$.msgbox({
			height:100,
			width:250,
			content:{type:'alert',content:'重复密码与用户密码不相同！'},
			animation:4
		});	
	}else{
		$.post(url,json,function(data){
			alert(data);
			if(data == 'ok'){
//				load();
				var id = <?php echo $_GET['id'];?>;
	
				updateItem(id);
			
			}		
		});
	}


}
</script>
<div class="form" style="width:400px;">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	'enableAjaxValidation'=>true,
)); ?>

	<?php echo Yii::t('admin','<p class="note">Fields with <span class="required">*</span> are required.</p>');?>	

	<?php echo $form->errorSummary($model); ?>
	<hr />
	<div class="row">
	<?php echo $form->labelEx($model,'user_password'); ?>
			<?php echo $form->passwordField($model,'user_password',array('style'=>'width:95%;')); ?>
			<?php echo $form->error($model,'user_password'); ?>
	</div>
	
	<div class="row">
	<?php echo $form->labelEx($model,'user_repassword'); ?>
			<?php echo $form->passwordField($model,'user_repassword',array('style'=>'width:95%;')); ?>
			<?php echo $form->error($model,'user_repassword'); ?>
	</div>

	<hr class="space" />
	<hr />
	<div class="row buttons">
	<?php
		$update = $this->createUrl('password',array('id'=>$model->user_id));
		
		$this->widget('zii.widgets.jui.CJuiButton',
		array(
					'name'=>'button',
					'buttonType'=>'button',
					'caption'=> Yii::t('admin', 'Save'),
					'htmlOptions'=>array(
						'onclick'=>'actionPassword($(this));',
						'cid'=> $update
		),
		));
	?>

	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->

<?php $this->widget('ext.box.colorbox.colorboxWidget',array(
		'id'=>'#example',
		'theme'=>'example1',
//		'options'=>'width:"50%", inline:true, href:"#uploadbox",onClosed:function(){ load(); }'
));?> 
<?php $this->widget('ext.msgbox.msgboxWidget');?>